import { createRouter, createWebHistory } from 'vue-router'
import ManagerVue from '@/views/Manager.vue'
import HomeView from '@/views/Home.vue'
import NotFound from '@/views/404.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: ManagerVue, // 作为布局组件
      redirect: '/home',
      children: [
        {
          path: 'home',
          component: HomeView, // 显示在 ManagerVue 的 RouterView 里
        },
        {
          path: '/admin',
          component: () => import('@/views/Admin.vue'),
        },{
          path: '/user',
          name:'用户信息',
          component: () => import('@/views/User.vue'),
        },
        {
          path: '/person',
          name:'个人信息',
          component: () => import('@/views/Person.vue'),
        },
        {
          path: '/password',
          name:'修改密码',
          component: () => import('@/views/UpdataPassword.vue'),
        },
        {
          path: '/notice',
          name:'系统公告',
          component: () => import('@/views/Notice.vue'),
        },
        {
          path: '/introduction',
          name:'旅游攻略',
          component: () => import('@/views/Introduction.vue'),
        },
        {
          path: '/category',
          name:'旅游线路',
          component: () => import('@/views/Category.vue'),
        },
      ],
    },
    
    {
      path: '/not',
      component: NotFound,
    },
    {
      path: '/login',
      component: () => import('@/views/Login.vue'),
    },
    {
      path: '/register',
      component: () => import('@/views/Register.vue'),
    },
    {
      path: '/:catchAll(.*)',
      redirect: '/not',
    },
  ],
})

export default router
